﻿/// Write a program that finds all prime numbers in the range [1...10 000 000]. 
/// Use the sieve of Eratosthenes algorithm (find it in Wikipedia).

using System;
using System.Collections;

class zad15
{
    static void Main()
    {
        bool[] falseTable = new bool[10000000];

        for (int i = 2; i < Math.Sqrt(falseTable.Length); i++)
        {

            for (int j = i * i; j < falseTable.Length; j = j + i)
            {
                falseTable[j] = true;
            }

        }

        ArrayList truthTAble = new ArrayList();
        
        for (int i = 2; i < falseTable.Length; i++)
        {
            
            if (falseTable[i] == false)
            {
                truthTAble.Add(i);
            }
        }

        for (int i = 0; i < 100; i++ )
        {
            Console.Write("{0}  ", truthTAble[i]);
        }
    }

}

